package mobilizator.app.list;

import java.util.List;

import mobilizator.app.R;
import mobilizator.app.data.Cloth;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ClothsAdapter extends BaseAdapter {

	private LayoutInflater inflater;
	private List<Cloth> cloths;
	
	public ClothsAdapter(Context ctx, List<Cloth> cloths) {
		this.inflater = (LayoutInflater) ctx
		        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		this.cloths = cloths;
	}
	
	public int getCount() {
		return cloths.size();
	}

	public Cloth getItem(int arg0) {
		return cloths.get(arg0);
	}

	public long getItemId(int arg0) {
		return arg0;
	}

	public View getView(int arg0, View arg1, ViewGroup arg2) {
		arg1 = inflater.inflate(
				R.layout.cloth_list_row, null);
		ImageView image = (ImageView) arg1.findViewById(R.id.cloth_list_image);
		TextView cloth = (TextView) arg1.findViewById(R.id.cloth_list_cloth);
		cloth.setText(cloths.get(arg0).getName());
		return arg1;
	}

	
	
}
